/*
 * 作者:熊猫
 * 日期:2017 - 3 - 20 10 - 48 - 40
 *
 */

package net.lainiao.morethread.Chapter8.demo3;

import java.util.concurrent.TimeUnit;

/**
 * Created by Administrator on 2017/3/20.
 */
public class Task implements Runnable {
    private long milliseconds;

    public Task(long milliseconds) {
        this.milliseconds = milliseconds;
    }

    @Override
    public void run() {
        String thName=Thread.currentThread().getName();
        System.out.println(thName+":Begin");
        try {
            TimeUnit.MILLISECONDS.sleep(milliseconds);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(thName+": End");
    }
}
